﻿@model OrderSettingsModel
@{
    //page title
    ViewBag.Title = T("Admin.Configuration.Settings.Order").Text;
}
@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
            @T("Admin.Configuration.Settings.Order")
        </div>
        <div class="options">
            <input type="submit" name="save" class="k-button" value="@T("Admin.Common.Save")" />
        </div>
    </div>
    @Html.Action("StoreScopeConfiguration", "Setting")
    @Html.ValidationSummary(false)

    
    <div id="ordersettings-edit">
        <ul>
            <li @Html.RenderSelectedTabIndex(0, GetSelectedTabIndex())>
                @T("Admin.Configuration.Settings.Order.OrderSettings")
            </li>
            <li @Html.RenderSelectedTabIndex(1, GetSelectedTabIndex())>
                @T("Admin.Configuration.Settings.Order.ReturnRequestSettings")
            </li>
        </ul>
        <div>
            @TabOrderSettings()
        </div>
        <div>
            @TabReturnRequestSettings()
        </div>
    </div>
    <script>
        $(document).ready(function() {
            $("#ordersettings-edit").kendoTabStrip({
                animation:  {
                    open: {
                        effects: "fadeIn"
                    }
                },
                select: tabstrip_on_tab_select
            });
        });
    </script>

    {
        //custom tabs
        var eventMessage = new AdminTabStripCreated(this.Html, "ordersettings-edit");
        EngineContext.Current.Resolve<IEventPublisher>().Publish(eventMessage);
        foreach (var eventBlock in eventMessage.BlocksToRender)
        {
            @eventBlock
        }
    }
     

     @*save selected tab index*@
	<input type="hidden" id="selected-tab-index" name="selected-tab-index" value="@(GetSelectedTabIndex())">
}
@helper TabOrderSettings()
{
    
    <script type="text/javascript">
        $(document).ready(function () {

            $("#@Html.FieldIdFor(model => model.OnePageCheckoutEnabled)").click(toggleOnePageCheckoutEnabled);

            toggleOnePageCheckoutEnabled();
        });

        function toggleOnePageCheckoutEnabled() {
            if ($('#@Html.FieldIdFor(model => model.OnePageCheckoutEnabled)').is(':checked')) {
                $('#pnlOnePageCheckoutDisplayOrderTotalsOnPaymentInfoTab').show();
            }
            else {
                $('#pnlOnePageCheckoutDisplayOrderTotalsOnPaymentInfoTab').hide();
            }
        }
        
    </script>
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.IsReOrderAllowed_OverrideForStore, model => model.IsReOrderAllowed, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.IsReOrderAllowed):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.IsReOrderAllowed)
                @Html.ValidationMessageFor(model => model.IsReOrderAllowed)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.MinOrderSubtotalAmount_OverrideForStore, model => model.MinOrderSubtotalAmount, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.MinOrderSubtotalAmount):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.MinOrderSubtotalAmount)
                @Html.ValidationMessageFor(model => model.MinOrderSubtotalAmount) @Model.PrimaryStoreCurrencyCode
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.MinOrderTotalAmount_OverrideForStore, model => model.MinOrderTotalAmount, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.MinOrderTotalAmount):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.MinOrderTotalAmount)
                @Html.ValidationMessageFor(model => model.MinOrderTotalAmount) @Model.PrimaryStoreCurrencyCode
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.AnonymousCheckoutAllowed_OverrideForStore, model => model.AnonymousCheckoutAllowed, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.AnonymousCheckoutAllowed):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AnonymousCheckoutAllowed)
                @Html.ValidationMessageFor(model => model.AnonymousCheckoutAllowed)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.TermsOfServiceOnShoppingCartPage_OverrideForStore, model => model.TermsOfServiceOnShoppingCartPage, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.TermsOfServiceOnShoppingCartPage):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.TermsOfServiceOnShoppingCartPage)
                @Html.ValidationMessageFor(model => model.TermsOfServiceOnShoppingCartPage)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.TermsOfServiceOnOrderConfirmPage_OverrideForStore, model => model.TermsOfServiceOnOrderConfirmPage, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.TermsOfServiceOnOrderConfirmPage):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.TermsOfServiceOnOrderConfirmPage)
                @Html.ValidationMessageFor(model => model.TermsOfServiceOnOrderConfirmPage)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.OnePageCheckoutEnabled_OverrideForStore, model => model.OnePageCheckoutEnabled, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.OnePageCheckoutEnabled):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.OnePageCheckoutEnabled)
                @Html.ValidationMessageFor(model => model.OnePageCheckoutEnabled)
            </td>
        </tr>
        <tr id="pnlOnePageCheckoutDisplayOrderTotalsOnPaymentInfoTab">
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.OnePageCheckoutDisplayOrderTotalsOnPaymentInfoTab_OverrideForStore, model => model.OnePageCheckoutDisplayOrderTotalsOnPaymentInfoTab, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.OnePageCheckoutDisplayOrderTotalsOnPaymentInfoTab):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.OnePageCheckoutDisplayOrderTotalsOnPaymentInfoTab)
                @Html.ValidationMessageFor(model => model.OnePageCheckoutDisplayOrderTotalsOnPaymentInfoTab)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.DisableBillingAddressCheckoutStep_OverrideForStore, model => model.DisableBillingAddressCheckoutStep, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.DisableBillingAddressCheckoutStep):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.DisableBillingAddressCheckoutStep)
                @Html.ValidationMessageFor(model => model.DisableBillingAddressCheckoutStep)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.DisableOrderCompletedPage_OverrideForStore, model => model.DisableOrderCompletedPage, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.DisableOrderCompletedPage):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.DisableOrderCompletedPage)
                @Html.ValidationMessageFor(model => model.DisableOrderCompletedPage)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.AttachPdfInvoiceToOrderPlacedEmail_OverrideForStore, model => model.AttachPdfInvoiceToOrderPlacedEmail, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.AttachPdfInvoiceToOrderPlacedEmail):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AttachPdfInvoiceToOrderPlacedEmail)
                @Html.ValidationMessageFor(model => model.AttachPdfInvoiceToOrderPlacedEmail)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.AttachPdfInvoiceToOrderCompletedEmail_OverrideForStore, model => model.AttachPdfInvoiceToOrderCompletedEmail, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.AttachPdfInvoiceToOrderCompletedEmail):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AttachPdfInvoiceToOrderCompletedEmail)
                @Html.ValidationMessageFor(model => model.AttachPdfInvoiceToOrderCompletedEmail)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.GiftCards_Activated_OrderStatusId):
            </td>
            <td class="adminData">
                @Html.DropDownListFor(model => model.GiftCards_Activated_OrderStatusId, Model.GiftCards_Activated_OrderStatuses)
                @Html.ValidationMessageFor(model => model.GiftCards_Activated_OrderStatusId)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.GiftCards_Deactivated_OrderStatusId):
            </td>
            <td class="adminData">
                @Html.DropDownListFor(model => model.GiftCards_Deactivated_OrderStatusId, Model.GiftCards_Deactivated_OrderStatuses)
                @Html.ValidationMessageFor(model => model.GiftCards_Deactivated_OrderStatusId)
            </td>
        </tr>
        @if (Model.OrderIdent.HasValue)
        {
            <tr>
                <td class="adminTitle">
                    @Html.NopLabelFor(model => model.OrderIdent):
                </td>
                <td class="adminData">
                    @Html.EditorFor(model => model.OrderIdent)
                </td>
            </tr>
        }
    </table>
}
@helper TabReturnRequestSettings()
{
    <table class="adminContent">
        <tr>
            <td class="adminTitle" colspan="2">
                @T("Admin.Configuration.Settings.Order.ReturnRequestsDescription1")
                <br />
                <br />
                @T("Admin.Configuration.Settings.Order.ReturnRequestsDescription2")
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.ReturnRequestsEnabled_OverrideForStore, model => model.ReturnRequestsEnabled, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.ReturnRequestsEnabled):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ReturnRequestsEnabled)
                @Html.ValidationMessageFor(model => model.ReturnRequestsEnabled)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.NumberOfDaysReturnRequestAvailable_OverrideForStore, model => model.NumberOfDaysReturnRequestAvailable, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.NumberOfDaysReturnRequestAvailable):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.NumberOfDaysReturnRequestAvailable)
                @Html.ValidationMessageFor(model => model.NumberOfDaysReturnRequestAvailable)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ReturnRequestReasonsParsed):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ReturnRequestReasonsParsed)
                @Html.ValidationMessageFor(model => model.ReturnRequestReasonsParsed)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ReturnRequestActionsParsed):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ReturnRequestActionsParsed)
                @Html.ValidationMessageFor(model => model.ReturnRequestActionsParsed)
            </td>
        </tr>
    </table>
}